package com.hlg.xboot.model;

import com.hlg.xboot.core.annotation.IgnoreQuery;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.util.Date;

/**
 * 带创建时间和更新时间的模型基类
 * Created by yangxin on 16/4/4.
 */
@MappedSuperclass
public abstract class BaseModel extends Model {

    @IgnoreQuery
    @Column(name = "create_time", updatable = false)
    protected Date createTime = new Date();

    @IgnoreQuery
    @JsonIgnore
    @Column(name = "update_time", insertable = false)
    protected Date updateTime = new Date();

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
